import com.apstex.ifc2x3toolbox.ifc2x3.*;
import com.apstex.ifc2x3toolbox.ifcmodel.IfcModel;
import com.apstex.step.core.ClassInterface;
import com.apstex.step.core.LIST;

import java.io.File;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

public class Writeting {
    public static void main(String[] args) throws Exception{
        IfcModel ifcModel = new IfcModel();
        File stepFile = new File("项目1.ifc");
        ifcModel.readStepFile(stepFile);
        Collection<ClassInterface> newObjects = new ArrayList<>();
        IfcWall wall1 = new IfcWall();
        IfcObjectPlacement ifcObjectPlacement = new IfcLocalPlacement();
        IfcProductRepresentation ifcProductRepresentation = new IfcProductRepresentation(new IfcLabel("jingshuain"),new IfcText("234"),new LIST<IfcRepresentation>());
        wall1.setGlobalId(new IfcGloballyUniqueId("123"));
        IfcPersonAndOrganization ifcPersonAndOrganization = new IfcPersonAndOrganization();
        IfcPerson ifcPerson = new IfcPerson(new IfcIdentifier("456"),new IfcLabel(""),new IfcLabel(""),new LIST<IfcLabel>(),new LIST<IfcLabel>(),new LIST<IfcLabel>(),new LIST<IfcActorRole>(),new LIST<IfcAddress>());
        IfcOrganization ifcOrganization = new IfcOrganization(new IfcIdentifier("478"),new IfcLabel(),new IfcText(),new LIST<IfcActorRole>(),new LIST<IfcAddress>());
        IfcApplication ifcApplication = new IfcApplication();
        IfcOwnerHistory ifcOwnerHistory = new IfcOwnerHistory();
        ifcPersonAndOrganization.setThePerson(ifcPerson);
        ifcPersonAndOrganization.setTheOrganization(ifcOrganization);
        ifcOwnerHistory.setOwningUser(ifcPersonAndOrganization);
        ifcOwnerHistory.setOwningApplication(ifcApplication);
        wall1.setObjectPlacement(ifcObjectPlacement);
        wall1.setOwnerHistory(ifcOwnerHistory);
        wall1.setName(new IfcLabel("wall1"));
        wall1.setDescription(new IfcText("jing"));
        wall1.setObjectType(new IfcLabel("基本墙:常规 - 300mm"));
        wall1.setObjectPlacement(new IfcLocalPlacement());
        wall1.setRepresentation(new IfcProductRepresentation());
        wall1.setTag(new IfcIdentifier(""));
        newObjects.add(wall1);
        newObjects.add(ifcProductRepresentation);
        newObjects.add(ifcObjectPlacement);
        newObjects.add(ifcOwnerHistory);
        newObjects.add(ifcOrganization);
        newObjects.add(ifcApplication);
        newObjects.add(ifcPerson);
        newObjects.add(ifcPersonAndOrganization);
        ifcModel.addObjects(newObjects);
        ifcModel.writeStepFile(stepFile);
    }
}
